Skip to content

feat!: Restructure provider factory, add create methods, migrate to uv#102

Merged
jsonbailey merged 13 commits intomainfrom
jb/aic-1664/adapter-executor-factory
Mar 25, 2026
Merged

feat!: Restructure provider factory, add create methods, migrate to uv#102
jsonbailey merged 13 commits intomainfrom
jb/aic-1664/adapter-executor-factory

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented Mar 10, 2026

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Provide links to any issues in this repository or elsewhere relating to this pull request.

Describe the solution you've provided

This PR contains two major changes:

1. Provider factory restructuring (breaking)

  • feat!: Rename OpenAIProviderOpenAIRunnerFactory; rename openai_provider.pyopenai_runner_factory.py
  • feat!: Rename LangChainProviderLangChainRunnerFactory; rename langchain_provider.pylangchain_runner_factory.py
  • feat!: Remove abstract static create(ai_config) from AIProvider ABC; see new create_[model|agent|agent_graph]
  • feat: Add create_model(), create_agent(), create_agent_graph() instance methods to AIProvider ABC (non-abstract, default warns)
  • feat!: Replace AIProviderFactory with RunnerFactory; delete ai_provider_factory.py
  • feat: RunnerFactory.create_model/agent/agent_graph() replace async AIProviderFactory.create()
  • fix: LDClient now calls RunnerFactory.create_model() synchronously instead of awaiting AIProviderFactory.create()

2. Poetry → uv migration

  • Migrate all packages from Poetry to uv as the package manager
  • Convert root pyproject.toml to a uv workspace configuration
  • Switch build backend from poetry-core to hatchling (langchain and openai provider packages)
  • Update all Makefiles to use uv run / uv sync / uv build
  • Update CI workflows (.github/workflows/ci.yml, release-please.yml) to use astral-sh/setup-uv instead of actions/setup-python + abatilo/actions-poetry
  • Update CI composite action (.github/actions/ci/action.yml) accordingly
  • Update CONTRIBUTING.md with uv-based setup instructions
  • Update .gitignore (poetry.lockuv.lock, add .venv/)

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Items for reviewer attention

  1. OpenAI import name inconsistency — In runner_factory.py, the LangChain connector is imported as LangChainRunnerFactory, but the OpenAI connector is still imported as OpenAIProvider. Verify this is intentional and matches the actual export from ldai_openai/__init__.py.

  2. CI action uv sync --all-groups without workspace_path — The old CI action ran poetry install scoped to inputs.workspace_path. The new action runs uv sync --all-groups at the repo root (workspace-level). Confirm this correctly installs deps for the specific package being tested, and doesn't mask missing dependency declarations.

  3. Release workflow changesrelease-please.yml removes all explicit actions/setup-python and abatilo/actions-poetry steps, relying on the composite CI action to set up uv. Verify the build/publish steps still produce correct distribution artifacts with hatchling instead of poetry-core.

  4. uv.lock not committed.gitignore excludes uv.lock, which is appropriate for libraries but means CI won't have reproducible installs. This is a deliberate tradeoff documented in the gitignore comment.


Note

Medium Risk
Introduces a breaking API rename and changes provider instantiation/creation flow, which can affect downstream integrations and runtime provider selection. Also adds new factory entry points (create_agent, create_agent_graph) that are currently provider-dependent and may return None if unsupported.

Overview
Replaces AIProviderFactory with a new RunnerFactory that centralizes provider loading, fallback selection, and capability construction via create_model, create_agent, and create_agent_graph.

Refactors the provider interface: AIProvider now acts as a per-provider factory with non-abstract create_* methods (defaulting to warnings/None), and the SDK client now uses RunnerFactory.create_model when creating chats and judges.

Updates the OpenAI and LangChain provider packages to expose OpenAIRunnerFactory/LangChainRunnerFactory and implement instance create_model (removing the async static create), including OpenAI client reuse/auto-creation and corresponding test updates.

Written by Cursor Bugbot for commit 22f67de. This will update automatically on new commits. Configure here.

Link to Devin session: https://app.devin.ai/sessions/7d5bda4d9dbe4ae0b950b30a50485e60
Requested by: @keelerm84

@jsonbailey jsonbailey marked this pull request as ready for review March 10, 2026 22:59
@jsonbailey jsonbailey requested a review from a team as a code owner March 10, 2026 22:59
@jsonbailey jsonbailey changed the title feat: Support addtional create methods for agent and agent_graph feat: Support additional create methods for agent and agent_graph Mar 10, 2026
@jsonbailey jsonbailey force-pushed the jb/aic-1664/adapter-executor-factory branch from dd194a8 to fd13f66 Compare March 11, 2026 17:25
@jsonbailey jsonbailey marked this pull request as draft March 11, 2026 17:26
@jsonbailey jsonbailey force-pushed the jb/aic-1664/adapter-executor-factory branch from fd13f66 to 4bef65c Compare March 11, 2026 17:55
@jsonbailey jsonbailey changed the title feat: Support additional create methods for agent and agent_graph feat: Support additional create methods for agent and agent_graph (PR-1) Mar 11, 2026
@jsonbailey jsonbailey changed the title feat: Support additional create methods for agent and agent_graph (PR-1) feat: Support additional create methods for agent and agent_graph (PR-2) Mar 11, 2026
jsonbailey and others added 3 commits March 25, 2026 08:54
Keep uv-based CI setup (drop poetry steps added in main), accept version
bump to 0.16.1 from main while preserving x-release-please-version comment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat!: Rename AIProviderFactory → RunnerFactory
feat!: Rename OpenAIProvider → OpenAIRunnerFactory import from ldai_openai.openai_runner_factory
feat!: Rename LangChainProvider to LangChainRunnerFactory import from ldai_langchain.langchain_runner_factory
feat: Add create_model(), create_agent(), create_agent_graph() to AIProvider ABC (non-abstract, default warns)
@jsonbailey jsonbailey force-pushed the jb/aic-1664/adapter-executor-factory branch from 4bef65c to e10be52 Compare March 25, 2026 14:33
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsonbailey jsonbailey marked this pull request as ready for review March 25, 2026 14:56
Base automatically changed from jb/aic-1664/uv-conversion to main March 25, 2026 15:51
Resolve conflicts:
- Makefiles (langchain, openai, server-ai): accept main's `uv sync --all-groups`
  over branch's `--group dev` to pick up the tooling update from main
- client.py: keep branch's `RunnerFactory` import (the PR 1 rename)
  over main's stale `AIProviderFactory` import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove module-level docstring strings from all modified files (not
  idiomatic Python)
- Replace all "connector" terminology with "provider" in class docstrings,
  method docstrings, and log warning messages
- Fix stale "ExecutorFactory" references in provider class docstrings
  → RunnerFactory
- Add assert guards for Optional[BaseChatModel] before invocation in
  LangChainRunnerFactory to satisfy mypy
- Fix trailing blank lines (W391) across modified files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jsonbailey and others added 3 commits March 25, 2026 11:47
Completes the rename that was done for the file (openai_provider.py →
openai_runner_factory.py) but missed the class itself. Updates all
references in __init__.py, runner_factory.py, and tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drop # --- AIProvider factory methods ---, # --- Model invocation ---,
# --- Convenience accessors ---, and # --- Public API --- from the
factory and provider classes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove stale PR 2 migration note from AIProvider docstring
- Remove 'two ways' prose from runner factory class and __init__ docstrings
- Replace log.warn with log.warning in ai_provider.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@jsonbailey jsonbailey changed the title feat: Support additional create methods for agent and agent_graph (PR-2) feat!: Restructure provider factory and support additional create methods (PR-2) Mar 25, 2026
@jsonbailey jsonbailey merged commit e6e4907 into main Mar 25, 2026
38 checks passed
@jsonbailey jsonbailey deleted the jb/aic-1664/adapter-executor-factory branch March 25, 2026 17:20
@github-actions github-actions bot mentioned this pull request Mar 26, 2026
@devin-ai-integration devin-ai-integration bot changed the title feat!: Restructure provider factory and support additional create methods (PR-2) feat!: Restructure provider factory, add create methods, migrate to uv Apr 1, 2026
jsonbailey added a commit that referenced this pull request Apr 2, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-server-sdk-ai: 0.17.0</summary>

##
[0.17.0](launchdarkly-server-sdk-ai-0.16.1...launchdarkly-server-sdk-ai-0.17.0)
(2026-04-02)


### ⚠ BREAKING CHANGES

* Bump minimum LangChain version to 1.0.0
* Split track_metrics_of into sync and async variants
([#112](#112))
* Remove node-scoped methods from AIGraphTracker (track_node_invocation,
track_tool_call, track_node_judge_response), use related AIConfigTracker
methods instead
* Extract shared utilities to openai_helper
* Extract shared utilities to langchain_helper
* Restructure provider factory and support additional create methods
([#102](#102))

### Features

* Add get_ai_usage_from_response to openai_helper
([4fab18f](4fab18f))
* Add get_tool_calls_from_response and sum_token_usage_from_messages to
langchain_helper
([4fab18f](4fab18f))
* Add LangGraphAgentGraphRunner
([56ce0fd](56ce0fd))
* Add LDAIClient.create_agent() returning ManagedAgent
([53fd95e](53fd95e))
* Add ManagedAgentGraph support
([#111](#111))
([56ce0fd](56ce0fd))
* Add ModelRunner ABC with invoke_model() and
([453c71c](453c71c))
* Add OpenAIAgentGraphRunner
([56ce0fd](56ce0fd))
* Add OpenAIAgentRunner with agentic tool-calling loop
([53fd95e](53fd95e))
* add optimization package stub
([872e81e](872e81e))
* Add optional graph_key to all LDAIConfigTracker track_* methods for
graph correlation
([4fab18f](4fab18f))
* Add track_tool_call/track_tool_calls to LDAIConfigTracker
([4fab18f](4fab18f))
* Adds optimization package stub
([58b7731](58b7731))
* Bump minimum LangChain version to 1.0.0
([dc592c5](dc592c5))
* Deprecated Chat object in favor of ManagedModel
([453c71c](453c71c))
* Deprecated create_chat(), use create_model() on the LDAIClient
([453c71c](453c71c))
* Drop support for python 3.9
([#114](#114))
([dc592c5](dc592c5))
* Extract shared utilities to langchain_helper
([453c71c](453c71c))
* Extract shared utilities to openai_helper
([453c71c](453c71c))
* Introduce ManagedAgent and AgentRunner implementations
([#110](#110))
([53fd95e](53fd95e))
* Introduce ManagedModel and ModelRunner (PR-3)
([#104](#104))
([453c71c](453c71c))
* Restructure provider factory and support additional create methods
([#102](#102))
([e6e4907](e6e4907))
* Split track_metrics_of into sync and async variants
([#112](#112))
([4fab18f](4fab18f))


### Bug Fixes

* make AIGraphTracker.track_total_tokens accept Optional[TokenUsage],
skip when None or total &lt;= 0
([4fab18f](4fab18f))
* Remove node-scoped methods from AIGraphTracker (track_node_invocation,
track_tool_call, track_node_judge_response), use related AIConfigTracker
methods instead
([4fab18f](4fab18f))
* use time.perf_counter_ns() for sub-millisecond precision in duration
calculations
([4fab18f](4fab18f))
</details>

<details><summary>launchdarkly-server-sdk-ai-langchain: 0.4.0</summary>

##
[0.4.0](launchdarkly-server-sdk-ai-langchain-0.3.2...launchdarkly-server-sdk-ai-langchain-0.4.0)
(2026-04-02)


### ⚠ BREAKING CHANGES

* Bump minimum LangChain version to 1.0.0
* Split track_metrics_of into sync and async variants
([#112](#112))
* Remove node-scoped methods from AIGraphTracker (track_node_invocation,
track_tool_call, track_node_judge_response), use related AIConfigTracker
methods instead
* Extract shared utilities to openai_helper
* Extract shared utilities to langchain_helper
* Restructure provider factory and support additional create methods
([#102](#102))

### Features

* Add get_ai_usage_from_response to openai_helper
([4fab18f](4fab18f))
* Add get_tool_calls_from_response and sum_token_usage_from_messages to
langchain_helper
([4fab18f](4fab18f))
* Add LangGraphAgentGraphRunner
([56ce0fd](56ce0fd))
* Add LDAIClient.create_agent() returning ManagedAgent
([53fd95e](53fd95e))
* Add ManagedAgentGraph support
([#111](#111))
([56ce0fd](56ce0fd))
* Add ModelRunner ABC with invoke_model() and
([453c71c](453c71c))
* Add OpenAIAgentGraphRunner
([56ce0fd](56ce0fd))
* Add OpenAIAgentRunner with agentic tool-calling loop
([53fd95e](53fd95e))
* add optimization package stub
([872e81e](872e81e))
* Add optional graph_key to all LDAIConfigTracker track_* methods for
graph correlation
([4fab18f](4fab18f))
* Add track_tool_call/track_tool_calls to LDAIConfigTracker
([4fab18f](4fab18f))
* Adds optimization package stub
([58b7731](58b7731))
* Bump minimum LangChain version to 1.0.0
([dc592c5](dc592c5))
* Deprecated Chat object in favor of ManagedModel
([453c71c](453c71c))
* Deprecated create_chat(), use create_model() on the LDAIClient
([453c71c](453c71c))
* Drop support for python 3.9
([#114](#114))
([dc592c5](dc592c5))
* Extract shared utilities to langchain_helper
([453c71c](453c71c))
* Extract shared utilities to openai_helper
([453c71c](453c71c))
* Introduce ManagedAgent and AgentRunner implementations
([#110](#110))
([53fd95e](53fd95e))
* Introduce ManagedModel and ModelRunner (PR-3)
([#104](#104))
([453c71c](453c71c))
* Restructure provider factory and support additional create methods
([#102](#102))
([e6e4907](e6e4907))
* Split track_metrics_of into sync and async variants
([#112](#112))
([4fab18f](4fab18f))


### Bug Fixes

* make AIGraphTracker.track_total_tokens accept Optional[TokenUsage],
skip when None or total &lt;= 0
([4fab18f](4fab18f))
* Remove node-scoped methods from AIGraphTracker (track_node_invocation,
track_tool_call, track_node_judge_response), use related AIConfigTracker
methods instead
([4fab18f](4fab18f))
* use time.perf_counter_ns() for sub-millisecond precision in duration
calculations
([4fab18f](4fab18f))
</details>

<details><summary>launchdarkly-server-sdk-ai-openai: 0.3.0</summary>

##
[0.3.0](launchdarkly-server-sdk-ai-openai-0.2.1...launchdarkly-server-sdk-ai-openai-0.3.0)
(2026-04-02)


### ⚠ BREAKING CHANGES

* Bump minimum LangChain version to 1.0.0
* Extract shared utilities to openai_helper
* Extract shared utilities to langchain_helper
* Restructure provider factory and support additional create methods
([#102](#102))

### Features

* Add LangGraphAgentGraphRunner
([56ce0fd](56ce0fd))
* Add LDAIClient.create_agent() returning ManagedAgent
([53fd95e](53fd95e))
* Add ManagedAgentGraph support
([#111](#111))
([56ce0fd](56ce0fd))
* Add ModelRunner ABC with invoke_model() and
([453c71c](453c71c))
* Add OpenAIAgentGraphRunner
([56ce0fd](56ce0fd))
* Add OpenAIAgentRunner with agentic tool-calling loop
([53fd95e](53fd95e))
* add optimization package stub
([872e81e](872e81e))
* Adds optimization package stub
([58b7731](58b7731))
* Bump minimum LangChain version to 1.0.0
([dc592c5](dc592c5))
* Deprecated Chat object in favor of ManagedModel
([453c71c](453c71c))
* Deprecated create_chat(), use create_model() on the LDAIClient
([453c71c](453c71c))
* Drop support for python 3.9
([#114](#114))
([dc592c5](dc592c5))
* Extract shared utilities to langchain_helper
([453c71c](453c71c))
* Extract shared utilities to openai_helper
([453c71c](453c71c))
* Introduce ManagedAgent and AgentRunner implementations
([#110](#110))
([53fd95e](53fd95e))
* Introduce ManagedModel and ModelRunner (PR-3)
([#104](#104))
([453c71c](453c71c))
* Restructure provider factory and support additional create methods
([#102](#102))
([e6e4907](e6e4907))
</details>

<details><summary>launchdarkly-server-sdk-ai-optimization:
0.1.0</summary>

## 0.1.0 (2026-04-02)


### ⚠ BREAKING CHANGES

* Bump minimum LangChain version to 1.0.0

### Features

* Add optimization package stub
([#109](#109))
([ebd5166](ebd5166))
* Adds optimization package stub
([58b7731](58b7731))
* Adds optimization package stub
([cc85a05](cc85a05))
* Bump minimum LangChain version to 1.0.0
([dc592c5](dc592c5))
* Drop support for python 3.9
([#114](#114))
([dc592c5](dc592c5))


### Bug Fixes

* consistency with other makefiles
([b9a5601](b9a5601))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk because this PR only updates release metadata (versions,
manifests, provenance docs, and changelogs) without changing runtime
code paths.
> 
> **Overview**
> Bumps package versions for the release: `launchdarkly-server-sdk-ai`
to `0.17.0`, LangChain provider to `0.4.0`, OpenAI provider to `0.3.0`,
and introduces/bumps `launchdarkly-server-sdk-ai-optimization` to
`0.1.0` (via `.release-please-manifest.json` and each package’s
`pyproject.toml`/`__init__.__version__`).
> 
> Updates `CHANGELOG.md` entries and `PROVENANCE.md` version references
to match the new release numbers.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
ae3e183. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jsonbailey <jbailey@launchdarkly.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants